package odgs.message.client;

import odgs.Connection;
import odgs.message.Message;
import odgs.message.MessageHandler;
import odgs.message.MessageProcessor;
import odgs.transaction.DirectoryAddTransaction;

public class DirectoryAddTransactionResponseHandler implements MessageHandler
{
	public void execute(MessageProcessor processor, Message msg, Connection con)
	{
		DirectoryAddTransaction trans = (DirectoryAddTransaction) msg.get("transaction");
		if(msg.getResult() < 0)
		{
			processor.getTransactionManager().error(msg.getResult(), trans);
		}
		else
		{
			processor.getTransactionManager().doneTransaction(trans.getRequestId());
			processor.getDataManager().addDirectory(trans.getSource());
		}
	}
}
